#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/9/18 10:13
# @Author  : youfeng
from enum.data_status import DataStatus
from ext.response_wrap import ResponseWrap


class ShixinService(object):
    def __init__(self, data_handler, log):
        self.log = log
        self.__data_handler = data_handler
        self.log.info("失信操作句柄初始化完成...")

    def get_data(self, company):
        status, data_result = self.__data_handler.get_shixin_data(company)
        if status == DataStatus.SUCCESS:
            return ResponseWrap.success(data_result)

        return ResponseWrap.fail(ResponseWrap.HTTP_OK, DataStatus.get_error_msg(status))
